#!/bin/bash

# 批量替换旧格式到新格式的脚本

echo "开始迁移旧格式到标准rules格式..."

# 替换 required: true 为 rules: [required]
find tests/ -name "*.yml" -o -name "*.yaml" -o -name "*.ts" | xargs sed -i '' 's/required: true/rules:\n        - required/g'

# 替换 unique: true 为在rules中添加unique
find tests/ -name "*.yml" -o -name "*.yaml" -o -name "*.ts" | xargs sed -i '' 's/unique: true/rules:\n        - unique/g'

# 替换 format: email 为在rules中添加format
find tests/ -name "*.yml" -o -name "*.yaml" -o -name "*.ts" | xargs sed -i '' 's/format: email/rules:\n        - format: email/g'

echo "迁移完成！"
